function sleep(milliSeconds){
	var startTime = new Date().getTime(); // get the current time
	while (new Date().getTime() < startTime + milliSeconds); // hog cpu
}
function hints(product_class_select)
{
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();

	}
	else
	{// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {

	var myObject = eval('(' + xmlhttp.responseText + ')');
	document.getElementById('brand_menus').options.length = 0;;
	document.getElementById('sub_brand_menus').options.length = 0;;


	for (x in myObject.brand_list){
		var opt = new Option(myObject.brand_list[x],myObject.brand_list[x]);
		document.getElementById('brand_menus').options.add(opt);

	}
	for (x in myObject.brand_sub_list){
		var opt = new Option(x,myObject.brand_sub_list[x]);
                document.getElementById('sub_brand_menus').options.add(opt);

	}
//    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }

  var r = xmlhttp.open("GET","product_class_change.php?class="+encodeURI(product_class_select.options[product_class_select.selectedIndex].value)+"&type=main_change",true);
  xmlhttp.send();
}

function hints_sub(product_class_select,product_brand)
{
if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();

	}
	else
	{// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {

	var myObject = eval('(' + xmlhttp.responseText + ')');
	document.getElementById('sub_brand_menus').options.length = 0;;


	for (x in myObject.brand_sub_list){
		var opt = new Option(x,myObject.brand_sub_list[x]);
                document.getElementById('sub_brand_menus').options.add(opt);

	}
//    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
  var r = xmlhttp.open("GET","product_class_change.php?class="+encodeURI(product_class_select.options[product_class_select.selectedIndex].value)+"&brand="+encodeURI(product_brand.options[product_brand.selectedIndex].value)+"&type=brand_change&x="+Math.random(),true);
  xmlhttp.send();

}

function insert_product()
{
   /* var product_class_object 		= this.document.getElementById('class_menus');
    var product_class	     		= product_class_object.options[product_class_object.selectedIndex].value;
    var product_brand_object 		= this.document.getElementById('brand_menus');
    var product_brand	     		= product_brand_object.options[product_brand_object.selectedIndex].value;*/
    var product_sub_brand_object	= this.document.getElementById('sub_brand_menus');
    var product_sub_brand		= encodeURI(product_sub_brand_object.options[product_sub_brand_object.selectedIndex].value); 
    var sns_group_object		= this.document.getElementById('sns_group');
    var sns_group			= encodeURI(sns_group_object.options[sns_group_object.selectedIndex].value);
    var product_name_object		= this.document.getElementById('product_name');
    var product_name			= encodeURI(product_name_object.value);
    var product_des_object		= this.document.getElementById('product_des');
    var product_des			= encodeURI(product_des_object.value);
    
    var request				= "product_brand="+product_sub_brand+"&sns_group="+sns_group+"&product_name="+product_name+"&product_des="+product_des;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();

	}
	else
	{// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {


    	document.getElementById("result").innerHTML= xmlhttp.responseText;
    }else{

       document.getElementById("result").innerHTML = "ooooooo";
    }
  }

  var r = xmlhttp.open("GET","../action/product_add.php?"+request+"&x="+Math.random(),true);

  xmlhttp.send();

  document.getElementById("result").innerHTML = "fasong ingddddd";

}
